//
//  Brand_Explore_Tbv_WX.m
//  ZITHER
//
//  Created by weixin on 2019/5/20.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Brand_Explore_Tbv_WX.h"
#import "Brand_ExploreRecommend_Cell_WX.h"
#import "Brand_ExploreAttention_Cell_WX.h"

@implementation Brand_Explore_Tbv_WX

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.delegate = self;
        self.dataSource = self;

    }
    return self;
}


#pragma mark -- tabdelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSInteger index = 0;

    if (self.HLMode.data.count==0) {
        index = 0;
    }else{
        index = self.HLMode.data.count-1;
    }
    
//    return self.arrM.count;
    if ( self.BFModel.list.count==0) {
        return index/3+1;
    }
    return index/3+1+1;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        static NSString *sectionCell = @"Brand_ExploreRecommend_Cell_WX";
        Brand_ExploreRecommend_Cell_WX * cell = [tableView dequeueReusableCellWithIdentifier:sectionCell];
        if (cell == nil) {
            cell = [[Brand_ExploreRecommend_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.BFModel = self.BFModel;
        return cell;
    } else {
    
//        goodVOsModel * model =  self.arrM[indexPath.row];
        static NSString *sectionCell = @"Brand_ExploreAttention_Cell_WX";
        Brand_ExploreAttention_Cell_WX * cell = [tableView dequeueReusableCellWithIdentifier:sectionCell];
        if (cell == nil) {
            cell = [[Brand_ExploreAttention_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.indexPath =indexPath;
        if (indexPath.row==1) {
            cell.TopTitle.hidden = NO;
            [cell.TopTitle mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(40);
            }];
        }else{
            cell.TopTitle.hidden = YES;
            [cell.TopTitle mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(0);
            }];
        }
        cell.HLMode = self.HLMode;
        return cell;
    }
  
}



-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
//    goodVOsModel * model =  self.arrM[indexPath.row];
//    STViewController *vc = [[STViewController alloc]init];
//    vc.type = STControllerTypeHiddenNavBar;
//    vc.goodId = model.goodInfo.id;
//    [self.getNav pushViewController:vc animated:YES];
    
}



- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

@end
